﻿@{
    ViewBag.Title = "Upload";
}

@section css
{
    <link href="@Url.Content("~/Content/uploadify/uploadify.css")" rel="stylesheet" />
}

@section script
{
    <script type="text/javascript" src="@Url.Content("~/Content/uploadify/jquery.uploadify.min.js")"></script>

    <script type="text/javascript">
        $(document).ready(function () {

            $("#btn_rescate_menu").load("/rescenter/getrescategorybtnmenu", { selectall: 0 }, function () { });

        });

        function initupload(cateno) {
            var defaults = {
                swf: '@Url.Content("~/Content/uploadify/uploadify.swf")',
                uploader: '@Url.Content("~/Resource/UploadHandle.ashx")',
                cancelImg: '@Url.Content("~/Content/uploadify/uploadify-cancel.png")',
                width: "80%",
                height: 30,
                formData: { folder: 'document', uploader: '@ViewBag.UserID', cateno: cateno },
                queueID: 'fileQueue',
                buttonText: '选择文件',
                fileTypeDesc: 'WORD 或 PDF 格式文件',
                fileTypeExts: '*.doc; *.docx; *.pdf;',
                auto: false,
                multi: true,
                onInit: function (instance) {
                    $("#uploadify_div").removeClass("hidden");
                }
            };

            $("#uploadify").uploadify(defaults);
        }

        function on_rescate_menu_click(cateno, catename) {
            $("#rescate_menu_text").text(catename);
            initupload(cateno);
        }
    </script>

}

<div class="container">
    <ol class="breadcrumb">
        <li><a href="/adm/rescenter">资源中心</a></li>
        <li><a href="/rescenter/document">我的文档</a></li>
        <li class="active">上传资源</li>
    </ol>

    <div class="panel panel-primary">
        <div class="panel-heading">
            上传文档资源 
        </div>
        <div class="panel-body">
            <label>上传至：？？</label>
            <div class="btn-group">
                <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                    <span id="rescate_menu_text">请选择分类</span><span class="caret"></span>
                </button>
                <ul class="dropdown-menu" role="menu" id="btn_rescate_menu">
                </ul>
            </div>
        </div>
    </div>

    <div class="panel panel-primary">

        <div class="panel-body" id="fileQueue" style="width: 500px; overflow: auto;">
            <span class="label label-danger">*.doc</span>
            <span class="label label-warning">*.docx</span>
            <span class="label label-success">*.pdf</span>
            <p>&nbsp;</p>
            <div id="uploadify_div" class="hidden">
                <input type="file" name="uploadify" id="uploadify" />
            </div>
        </div>
        <div class="panel-footer">
            <p>
                <a href="javascript:$('#uploadify').uploadify('upload','*')">上传全部</a>
                &nbsp;&nbsp;&nbsp;
                <a href="javascript:$('#uploadify').uploadify('cancel','*')">取消全部</a>
            </p>
        </div>
    </div>

</div>
